package com.ks.fission.controller;

import com.ks.core.base._ControllerBase;
import com.ks.core.core.Result;
import com.ks.core.dto.SearchCriteriaBase;
import com.ks.fission.controller.dto.BFissionTaskRequest;
import com.ks.fission.entity.BFissionTask;
import com.ks.fission.service.IBFissionTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/bFissionTask")
@Api(value = "应用端分享裂变任务模块", description = "应用端分享裂变任务模块")
public class BFissionTaskClientController extends _ControllerBase {

    @Resource
    private IBFissionTaskService ibFissionTaskService;

    @PostMapping("/getBFissionTaskClient")
    @ApiOperation(value = "应用端会员领取任务接口", notes = "BFissionTask id")
    public Object getBFissionTaskClient(@RequestBody BFissionTaskRequest bFissionTaskRequest) {
        int i=ibFissionTaskService.getBFissionTask(getContext(),bFissionTaskRequest);
        return Result.success(i);
    }


    @PostMapping("/selectTaskList")
    @ApiOperation(value = "分享任务列表", notes = "分享任务列表")
    public Object selectTaskList(@RequestBody SearchCriteriaBase searchCriteriaBase) {
        Map<String,Object> resultMap=ibFissionTaskService.selectTaskList(getContext(),searchCriteriaBase);
        return Result.success(resultMap);
    }


    @PostMapping("/addTaskViews")
    @ApiOperation(value = "分享任务浏览", notes = "分享任务浏览")
    public Object addTaskViews(@RequestBody BFissionTaskRequest bFissionTaskRequest) {
        int resultMap=ibFissionTaskService.addTaskViews(getContext(),bFissionTaskRequest);
        return Result.success(resultMap);
    }

}
